<style>
    .layui-layer-page {
        width: 900px !important;
    }
</style>
<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
    <div class="layui-card-body">
        <blockquote class="layui-elem-quote" style="text-align: center;">仓库基本参数</blockquote>
        <div class="layui-form-item nowrap">
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">所属平台</label>
                <div class="layui-input-inline margin-right-0" style="width:140px">
                    <select name='platform_id' class='layui-select' lay-search lay-filter="platform_id">
                        <!--{foreach $platform as $k=>$v}-->
                        <!--{eq name='v.id' value='$vo.platform_id|default=0'}-->
                        <option selected value='{$v.id}' data-is_rate="{$v.is_rate}" data-rate="{$v.rate}">{$v.name}</option>
                        <!--{else}-->
                        <option value='{$v.id}' data-is_rate="{$v.is_rate}" data-rate="{$v.rate}">{$v.name}</option>
                        <!--{/eq}-->
                        <!--{/foreach}-->
                    </select>  
                </div>
            </div>
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label"  style="width:auto">城市级别</label>
                <div class="layui-input-inline margin-right-0" style="width:150px">
                        <select name='city_level' class='layui-select' lay-search>
                            <!--{foreach [0=>'L1城市',1=>'L2城市',2=>'L3城市'] as $k=>$v}-->
                            <!--{eq name='k' value='$vo.city_level|default=0'}-->
                            <option selected value='{$k}'>{$v}</option>
                            <!--{else}-->
                            <option value='{$k}'>{$v}</option>
                            <!--{/eq}-->
                            <!--{/foreach}-->
                        </select>
                </div>
            </div>
            
        </div>
        <div class="layui-form-item nowrap">
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">仓库名称</label>
                <div class="layui-input-inline margin-right-0" style="width:150px">
                    <input name="name" value='{$vo.name|default=""}' required placeholder="请输入仓库名称"
                        class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label" style="width:auto">接仓类型</label>
                <div class="layui-input-inline margin-right-0" style="width:140px">
                    <input name="type" value='{$vo.type|default=""}' required placeholder="请输入接仓类型"
                        class="layui-input">
                </div>
            </div>
            
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label" style="width:auto">仓库地点</label>
                <div class="layui-input-inline margin-right-0" style="width:150px">
                    <input name="site" value='{$vo.site|default=""}' required placeholder="请输入仓库地点"
                        class="layui-input">
                </div>
            </div>
            
        </div>
        <div class="layui-form-item nowrap">
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">仓库面积</label>
                <div class="layui-input-inline margin-right-0" style="width:140px">
                    <input name="area" value='{$vo.area|default=""}' required placeholder="请输入仓库面积"
                        class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label" style="width:auto">仓库租金</label>
                <div class="layui-input-inline margin-right-0" style="width:150px">
                    <input name="rent" value='{$vo.rent|default=""}' required placeholder="请输入仓库租金"
                        class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label" style="width:auto">配送日期</label>
                <div class="layui-input-inline margin-right-0" style="width:150px">
                    <input type="text" data-date-input="date" name="delivery_at" required value='{$vo.delivery_at|default=""}'
                        placeholder="请输入配送日期" class="layui-input">
                </div>
            </div>
            
        </div>
        <div class="layui-form-item nowrap">
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">开仓日期</label>
                <div class="layui-input-inline margin-right-0" style="width:140px">
                    <input type="text" data-date-input="date" name="open_at" required value='{$vo.open_at|default=""}'
                        placeholder="请输入开仓日期" class="layui-input">
                </div>
            </div>
            
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label" style="width:auto">平台账单日期</label>
                <div class="layui-input-inline margin-right-0" style="width:150px">
                    <input type="text" data-date-input="date" name="complete_at" required value='{$vo.complete_at|default=""}'
                        placeholder="请输入平台结算时间" class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label" style="width:auto">预估团点</label>
                <div class="layui-input-inline margin-right-0" style="width:150px">
                    <input name="tuan_point" value='{$vo.tuan_point|default=""}' required placeholder="请输入预估团点"
                        class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item nowrap">
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">预估单量</label>
                <div class="layui-input-inline margin-right-0" style="width:140px">
                    <input name="order_count" value='{$vo.order_count|default=""}' required placeholder="请输入预估单量"
                        class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label" style="width:auto">保底数量</label>
                <div class="layui-input-inline margin-right-0" style="width:140px">
                    <input name="floor_count" value='{$vo.floor_count|default=""}' required placeholder="请输入保底量"
                        class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label" style="width:auto">保底截止日期</label>
                <div class="layui-input-inline margin-right-0" style="width:150px">
                    <input data-date-input="date" name="floor_end_at" value='{$vo.floor_end_at|default=""}' required placeholder="请输入保底截止日期"
                        class="layui-input">
                </div>
            </div>
            
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">商务合同</label>
            <label class="layui-col-xs8 think-form-group-left">
                <input name="contract" value='{$vo.contract|default=""}' placeholder="请上传pdf格式的商务合同" class="layui-input">
            </label>
            <a class="layui-col-xs2 layui-btn think-form-group-right" data-uptype="local" data-file="one" data-field="contract" data-type="pdf">
                <i class="layui-icon layui-icon-upload"></i> 上传文件
            </a>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">考核标准</label>
            <div class="layui-input-block">
                <textarea name="standard" class="layui-textarea" placeholder="请输入考核标准">{$v.standard|default=""}</textarea>
            </div>
        </div>
        <blockquote class="layui-elem-quote" style="text-align: center;">仓库运营参数</blockquote>
        <div class="layui-form-item nowrap">
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">标准人效</label>
                <div class="layui-input-inline margin-right-0" style="width:140px">
                    <input name="man_eff" value='{$vo.man_eff|default=""}' required placeholder="请输入标准人效"
                        class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label" style="width:auto">标准时效</label>
                <div class="layui-input-inline margin-right-0" style="width:150px">
                    <input name="time_eff" value='{$vo.time_eff|default=""}' required placeholder="请输入标准时效"
                        class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label" style="width:auto">标准车效</label>
                <div class="layui-input-inline margin-right-0" style="width:150px">
                    <input name="car_eff" value='{$vo.car_eff|default=""}' required placeholder="请输入标准车效"
                        class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item nowrap">
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">团点单价</label>
                <div class="layui-input-inline margin-right-0" style="width:150px">
                    <input name="operating_tuan_price" value='{$vo.operating_tuan_price|default=""}' required placeholder="请输入工作小时数"
                        class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label" style="width:auto">工作小时数</label>
                <div class="layui-input-inline margin-right-0" style="width:150px">
                    <input name="hours" value='{$vo.hours|default=""}' required placeholder="请输入工作小时数"
                        class="layui-input">
                </div>
            </div>
        </div>
        <blockquote class="layui-elem-quote" style="text-align: center;">仓库收入参数</blockquote>
        <div class="layui-form-item nowrap">
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">基础单价</label>
                <div class="layui-input-inline margin-right-0" style="width:140px">
                    <input name="unit_price" value='{$vo.unit_price|default=""}' required placeholder="请输入基础单价"
                        class="layui-input" oninput="rate()">
                </div>
            </div>
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label" style="width:auto">考核单价</label>
                <div class="layui-input-inline margin-right-0" style="width:150px">
                    <input name="reward_price" value='{$vo.reward_price|default=""}' placeholder="请输入考核单价"
                        class="layui-input" oninput="rate()">
                </div>
            </div>
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label" style="width:auto">团点单价</label>
                <div class="layui-input-inline margin-right-0" style="width:150px">
                    <input name="income_tuan_price" value='{$vo.income_tuan_price|default=""}' placeholder="请输入团点单价"
                        class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item nowrap">
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">还原含税基础单价</label>
                <div class="layui-input-inline margin-right-0" style="width:100px">
                    <input name="rate_unit_price" value='{$vo.rate_unit_price|default=""}' readonly
                        class="layui-input layui-bg-gray">
                </div>
            </div>
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label" style="width:auto">还原含税考核单价</label>
                <div class="layui-input-inline margin-right-0" style="width:100px">
                    <input name="rate_reward_price" value='{$vo.rate_reward_price|default=""}' readonly
                        class="layui-input layui-bg-gray">
                </div>
            </div>
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label" style="width:auto">超距离补贴</label>
                <div class="layui-input-inline margin-right-0" style="width:150px">
                    <input name="distance_price" value='{$vo.distance_price|default=""}' required placeholder="请输入超距离补贴"
                        class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item nowrap">
            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">大件补贴单价</label>
                <div class="layui-input-inline margin-right-0" style="width:140px">
                    <input name="big_price" value='{$vo.big_price|default=""}' placeholder="请输入大件补贴单价"
                        class="layui-input ">
                </div>
            </div> 
        </div>   
    </div>

    <div class="hr-line-dashed"></div>
    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}

    <div class="layui-form-item text-center">
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>

    <script>
    window.form.render();
    $(function(){
        rate();
    })
    form.on('select(platform_id)', function (data) {
        rate();
    });
    function rate(){
        var is_rate = Number($("select[name='platform_id']").find("option:selected").data('is_rate'));
        var rate = Number($("select[name='platform_id']").find("option:selected").data('rate'));
        var unit_price = Number($("input[name='unit_price']").val());
        var reward_price = Number($("input[name='reward_price']").val());
        console.log(rate * unit_price);
        if(is_rate == 0){
            $("input[name='rate_unit_price']").val(unit_price);
            $("input[name='rate_reward_price']").val(reward_price);
        }else{
            $("input[name='rate_unit_price']").val((rate * unit_price).toFixed(2));
            $("input[name='rate_reward_price']").val((rate * reward_price).toFixed(2));
        }
        
    }
    </script>

</form>